Skip to content

Conversation

erikmueller
Copy link
Contributor

@erikmueller erikmueller commented Nov 29, 2017

Inspired by http://blog.overstuffedgorilla.com/render-react-with-phoenix/ my use case was playing around with rendering react-router v4 inside an elixir application.

I had the problem of not being able to pass context that is set during route matching in the react-router (and maybe populated with a response status) back to the plug.Router (to set the statusCode).

I solved this with setting a context object on the component itself and passing that back to the caller (the plug.Router in that case). This may not be the most elegant solution but the only that came to my mind. Maybe s/o has something more awesome up their sleeves ;)

Basically works like described in the contextComponent and sInce I was too afraid to break sth I wrote some tests ^^

@erikmueller erikmueller force-pushed the feature/additional-context branch from 81fe472 to eace0db Compare November 29, 2017 21:39
@erikmueller erikmueller force-pushed the feature/additional-context branch from eace0db to 7db47dd Compare November 29, 2017 21:40
@erikmueller
Copy link
Contributor Author

@mjackson any thoughts?

@mjackson
Copy link
Member

Hey @erikmueller, sorry for the long silence here. I like this solution! Also, thanks for the tests! 😅

I'll merge and release in the next patch release.

@mjackson mjackson merged commit 7db47dd into ReactTraining:master Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants